package com.ansion.commonchat.contact.systemcontact;

import android.provider.ContactsContract.CommonDataKinds;

import com.ansion.utils.GsonUtil;
import com.ansion.utils.ResourceUtils;

import java.io.Serializable;

public class AndroidContactPhoneBean implements Serializable,Comparable<AndroidContactPhoneBean> {
    
    
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    private String phone="";
    
    private String phoneOriginal="";
    
//    private String phoneMd5="";
    
    private int phoneType=-1;
    
    private int rowId=-1;
    
    private String label;

    public int timesContacted;

    public long last_timecontacted;

    public int position;

	public AndroidContactPhoneBean() {
	}

    public AndroidContactPhoneBean(String phone, String phoneOriginal, String phoneMd5, int phoneType) {
        super();
        this.phone = phone;
        this.phoneOriginal = phoneOriginal;
//        this.phoneMd5 = phoneMd5;
        this.phoneType = phoneType;
    }



    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getPhoneOriginal() {
        return phoneOriginal;
    }

    public void setPhoneOriginal(String phoneOriginal) {
        this.phoneOriginal = phoneOriginal;
    }
    
    

//    public String getPhoneMd5() {
//        return phoneMd5;
//    }

//    public void setPhoneMd5(String phoneMd5) {
//        this.phoneMd5 = phoneMd5;
//    }

    public CharSequence getLabel() {
    	return  CommonDataKinds.Phone.getTypeLabel(ResourceUtils.getContext().getResources(), phoneType, label);
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public int getPhoneType() {
        return phoneType;
    }

    public void setPhoneType(int phoneType) {
        this.phoneType = phoneType;
    }
    
    public int getRowId() {
		return rowId;
	}
    
    public void setRowContactId(int rowId) {
		this.rowId = rowId;
	}

    @Override
    public String toString() {
        return GsonUtil.toJson(this);
    }

    @Override
    public int compareTo(AndroidContactPhoneBean o) {
        if(o == null)
            return 1;
        //按照position从小到大排
        return Integer.compare(position,o.position);
    }
}
